{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "我吃了二两小米粥，增加了45卡路里\n",
      "我吃了二两粗粮馒头，增加了223卡路里\n",
      "我吃了二两全麦面包，增加了235卡路里\n",
      "我吃了二两瘦猪肉，增加了143卡路里\n",
      "我吃了二两鸡翅，增加了194卡路里\n",
      "我吃了二两培根，增加了181卡路里\n",
      "我吃了二两火腿肠，增加了212卡路里\n"
     ]
    }
   ],
   "source": [
    "calories={'小米粥': '45',\n",
    "'粗粮馒头': '223',\n",
    "'全麦面包' :'235',\n",
    "'瘦猪肉': '143',\n",
    "'鸡翅': '194',\n",
    "'培根': '181',\n",
    "'火腿肠': '212'}\n",
    "\n",
    "for food,calorie in calories.items():\n",
    "    print(\"我吃了二两%s，增加了%s卡路里\" % (food,calorie))\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "猜猜看进行慢走 (一小时4公里)运动会消耗多少卡路里\n",
      "\n",
      "你认为是哪个答案?\n",
      "255卡 655卡 440卡 \n",
      "- 255卡\n",
      "恭喜你答对了\n",
      "猜猜看进行慢跑 (一小时9公里)运动会消耗多少卡路里\n",
      "\n",
      "你认为是哪个答案?\n",
      "255卡 655卡 440卡 \n",
      "- 655卡\n",
      "恭喜你答对了\n",
      "猜猜看进行羽毛球（一小时）运动会消耗多少卡路里\n",
      "\n",
      "你认为是哪个答案?\n",
      "255卡 655卡 440卡 \n",
      "- 440卡\n",
      "恭喜你答对了\n"
     ]
    }
   ],
   "source": [
    "question_answer = {'慢走 (一小时4公里)': '255卡',\n",
    "                '慢跑 (一小时9公里)': '655卡',\n",
    "                '羽毛球（一小时）': '440卡'\n",
    "                }\n",
    "def show_option(question_answer):\n",
    "    answers=''\n",
    "    for answer in question_answer.values():\n",
    "        answers=answers+answer+' '\n",
    "    print(answers)\n",
    "\n",
    "\n",
    "for question in question_answer.keys():\n",
    "    print(\"猜猜看进行%s运动会消耗多少卡路里\" % question)\n",
    "    correct=False\n",
    "    while not correct:\n",
    "        print(\"\\n你认为是哪个答案?\")\n",
    "        show_option(question_answer)\n",
    "        get_answer = input(\"- \")\n",
    "        if get_answer==question_answer[question]:\n",
    "            print(\"恭喜你答对了\")\n",
    "            correct=True\n",
    "            \n",
    "        else:\n",
    "            print(\"抱歉答错了,换个答案试试\")\n",
    "        \n",
    "            \n",
    "        \n",
    "        \n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "九岭头海拔1794米\n",
      "五虎岗海拔1891米\n",
      "军峰山海拔1760.9米\n",
      "南风面海拔2120.4米\n",
      "武功山金顶(白鹤峰)海拔1918.3米\n",
      "独竖尖海拔2128米\n",
      "玉京峰海拔1819.9米\n",
      "过风坳海拔1887米\n",
      "黄岗山海拔2157.8米\n",
      "齐云山海拔2061.3米\n"
     ]
    }
   ],
   "source": [
    "mountains = {'军峰山': '海拔1760.9米',\n",
    "                '九岭头': '海拔1794米',\n",
    "                '玉京峰': '海拔1819.9米',\n",
    "                '过风坳': '海拔1887米',\n",
    "                '五虎岗': '海拔1891米',\n",
    "                '武功山金顶(白鹤峰)': '海拔1918.3米',\n",
    "                '齐云山': '海拔2061.3米',\n",
    "                '南风面': '海拔2120.4米',\n",
    "                '独竖尖': '海拔2128米',\n",
    "                '黄岗山': '海拔2157.8米',\n",
    "                }\n",
    "\n",
    "for mountain in sorted(mountains.keys()):\n",
    "    print(\"%s%s\" % (mountain, mountains[mountain]))\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "我知道的maolaodi, :\n",
      "性别: 男\n",
      "爱好: make money\n",
      "最爱: noting\n",
      "\n",
      "我知道的caolaoge, :\n",
      "性别: 男\n",
      "爱好: zhishu\n",
      "最爱: zhishu\n"
     ]
    }
   ],
   "source": [
    "roommates = {'maolaodi': {'性别': '男', '爱好': 'make money', '最爱':'noting'},\n",
    "        'caolaoge': {'性别': '男', '爱好': 'zhishu', '最爱':'zhishu'},\n",
    "            }\n",
    "\n",
    "for roommate_name, roommate_information in roommates.items():\n",
    "    print(\"\\n我知道的%s, :\" % roommate_name)\n",
    "    print(\"性别: \" + roommate_information['性别'])\n",
    "    print(\"爱好: \" + roommate_information['爱好'])\n",
    "    print(\"最爱: \" + roommate_information['最爱'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
